package org.lb.MarketingSystem.serviceImpl;

import java.util.List;

import org.lb.MarketingSystem.dao.ProductMapperDao;
import org.lb.MarketingSystem.entity.Product;
import org.lb.MarketingSystem.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component(value="ProductServiceImpl")
public class ProductServiceImpl implements ProductService{

	@Autowired
	private ProductMapperDao productMapperDao;
	public List<Product> get_AllProducts() {
		return productMapperDao.select_AllProducts();
	}

	public boolean updateProduct(Product product) {
		return productMapperDao.updateProduct(product);
	}

	public boolean deleteProduct(Integer productId) {
		return productMapperDao.dropProduct(productId);
	}

	public boolean addProduct(Product product) {
		return productMapperDao.insertProduct(product);
	}

	public List<Product> getProductsByType(String Type) {
		// TODO Auto-generated method stub
		return null;
	}

	public List<Product> getProductsByPrice(double price1, double price2) {
		// TODO Auto-generated method stub
		return null;
	}

	public List<Product> getProductsByPriceAndTypeName(double price1, double price2, String TypeName) {
		// TODO Auto-generated method stub
		return null;
	}

	public List<Product> getProductsByPrices(double price1, double price2) {
		// TODO Auto-generated method stub
		return null;
	}

	public List<Product> getproductByproductTypeID(int productTypeID) {
		// TODO Auto-generated method stub
		return productMapperDao.selectproductByproductTypeID(productTypeID);
	}

	public List<Product> getproductCountByType(int productTypeID) {
		// TODO Auto-generated method stub
		return productMapperDao.selectproductCountByType(productTypeID);
	}

	public List<Product> getproductByPage(int productTypeID,int page) {
		int startT=8*(page-1);
		return productMapperDao.selectproductByPage(productTypeID,startT);
	}

}
